# from django.shortcuts import render
# import os
# from xm.settings import BASE_DIR
#
#
# def upfile(request):
#     if request.method=="GET":
#         return render(request,"upfile.html")
#
#     if request.method=="POST":
#         myfileobj=request.FILES.get("myfile")
#         print(type(myfileobj))
#
#         f=open(os.path.join(BASE_DIR,"static",'pic',myfileobj.name),'wb')
#         for chunk in myfileobj.chunks():
#             f.write(chunk)
#         f.close()
#         return render(request,"upfile.html")
#
# def download(request,filename):
#     file=open(os.path.join(BASE_DIR,'static','pic',filename),'rb')
#     response=StreamingHttpResponse(file)
#     response['Content-Type']='application/octet-stream'
#     response['Content-Disposition']='attachent;filename="{}“'.format(filename)
#     return response